﻿Public Class frmPkgType

    Private tklInput As TenKeyLabel

    Public Sub New(ByRef lblInput As TenKeyLabel)
        tklInput = lblInput

        ' この呼び出しはデザイナーで必要です。
        InitializeComponent()

        ' InitializeComponent() 呼び出しの後で初期化を追加します。

    End Sub

    Private Sub TenKeyLabel1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        CallTenkey(CType(sender, TenKeyLabel))
    End Sub

    Private Sub ltlMap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ltlMap.Click
        CallTenkey(CType(sender, LiteralLabel).InputLabel)
    End Sub

    Private Sub CallTenkey(ByRef lblInput As TenKeyLabel)
        'Me.Focus()
        Dim tk As New TenKey(lblInput)
        tk.Left = Me.Width - tk.Width
        tk.Top = Me.Height - tk.Height
        AddHandler tk.InputCompleted, AddressOf Tenkey_Done
        Me.Controls.Add(tk)
    End Sub

    Private Sub Tenkey_Done(ByVal sender As Object)
        tklInput.Text = ltlMap.Text & ltlMap.Literal
        tklInput.EndEdit()
        Me.Close()
    End Sub

    Private Sub btn2Map_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn2Map.Click
        tklInput.Text = CType(sender, Button).Text
        tklInput.EndEdit()
        Me.Close()
    End Sub

    Private Sub btnOnPak_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOnPak.Click
        tklInput.Text = CType(sender, Button).Text
        tklInput.EndEdit()
        Me.Close()
    End Sub

    Private Sub btnOther_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOther.Click
        tklInput.Text = CType(sender, Button).Text
        tklInput.EndEdit()
        Me.Close()
    End Sub

    Private Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        tklInput.EndEdit()
        Me.Close()
    End Sub

End Class